<template>
  <orh-table>
        <Button slot="option" type="primary" @click="update">编辑</Button>
        <information-detail v-if="detailed" slot="table" :teacher_id="teacher_id" :user_id="user_id"></information-detail>
        <orh-sidebar v-model="isShow" :title="titles" cover slot="others">
            <information-edit v-if="isShow" @showedit="showedit=>isShow=showedit" :teacher_id="teacher_id" @roaldedit="roaldedit"></information-edit>
        </orh-sidebar>
  </orh-table>
</template>



<script>
  export default {
    name:"teacher-myinformation",
    components: {
		InformationDetail: resolve => {require(['../Public/InformationDetail.vue'], resolve);},
        InformationEdit: resolve => {require(['../TeacherInformation/InformationEdit.vue'], resolve);},
    },
    data() {
      return {
        teacher_id:null,
        user_id:null,
        
        titles:'',
        isShow:false,
        
        detailed:null,
        
      }
    },
    methods: {

        /************************************************************
         * 
         * 请求数据
         * 
         ************************************************************/
        Information(){
            this.$http.get('api/teacher/v1/get/teacher/info').then(val=>{
                this.detailed=val.data
                this.teacher_id=val.data.teacher_id
                this.user_id=val.data.user_id

            })
            .catch(err=>{
                if(err.code && err.code==422) {
                    this.$Message.error(err.message);
                }
            })
        },

        /************************************************************
         * 
         * 修改返回指
         * 
         ************************************************************/
        roaldedit(val){
            if(val == true){
            this.Information()
            }
        },

        /************************************************************
         * 
         * 点击编辑
         * 
         ************************************************************/
        update(){
            this.isShow=true;
            this.titles='修改';
        },
    },
    created() {
        this.Information()
        
    }

  }
</script>
